package com.renwei.yunlong.activity;

import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.renwei.yunlong.R;
import com.renwei.yunlong.base.BaseActivity;
import com.zyf.fwms.commonlibrary.utils.AutoUtils;
import com.zyf.fwms.commonlibrary.utils.CommonUtils;
import com.zyf.fwms.commonlibrary.utils.StatusBarUtil;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * 备件申请--页面
 *
 * Created by Administrator on 2017/8/29.
 */

public class SparePartsApplicationActivity extends BaseActivity implements View.OnClickListener {

    @Bind(R.id.iv_back)
    ImageView ivBack;
    @Bind(R.id.tv_title)
    TextView tvTitle;
    @Bind(R.id.tv_basic)
    TextView tvBasic;
    @Bind(R.id.view_basic)
    View viewBasic;
    @Bind(R.id.rl_click_basic)
    RelativeLayout rlClickBasic;//基本信息
    @Bind(R.id.tv_annex)
    TextView tvAnnex;
    @Bind(R.id.view_annex)
    View viewAnnex;
    @Bind(R.id.rl_click_annex)
    RelativeLayout rlClickAnnex;//添加附件

    @Bind(R.id.rl_annex)
    RelativeLayout rlAnnex;//添加附件列表
    @Bind(R.id.ll_basic)
    LinearLayout llBasic;//基本信息列表

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_spare_parts_application);
        ButterKnife.bind(this);

        StatusBarUtil.setColor(this, CommonUtils.getColor(this, R.color.title_color), 0);
        //屏幕自适配
        AutoUtils.setSize(this, false, 720, 1280);
        AutoUtils.auto(this);

        initData();
    }

    private void initData() {
        ivBack.setVisibility(View.VISIBLE);
        tvTitle.setText("备件申请");
        ivBack.setOnClickListener(this);
        rlClickBasic.setOnClickListener(this);
        rlClickAnnex.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.iv_back:
                finish();
                break;
            case R.id.rl_click_basic:
                tvBasic.setTextColor(getResources().getColor(R.color.blue_color));
                viewBasic.setVisibility(View.VISIBLE);

                tvAnnex.setTextColor(getResources().getColor(R.color.text_gray_color));
                viewAnnex.setVisibility(View.GONE);

                llBasic.setVisibility(View.VISIBLE);
                rlAnnex.setVisibility(View.GONE);
                break;
            case R.id.rl_click_annex:
                tvAnnex.setTextColor(getResources().getColor(R.color.blue_color));
                viewAnnex.setVisibility(View.VISIBLE);

                tvBasic.setTextColor(getResources().getColor(R.color.text_gray_color));
                viewBasic.setVisibility(View.GONE);

                llBasic.setVisibility(View.GONE);
                rlAnnex.setVisibility(View.VISIBLE);
                break;
            default:
                break;
        }
    }
}
